<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm',array(
	'id'=>'sales-journal-form',
	'enableAjaxValidation'=>false,
)); ?>

<p class="help-block">Fields with <span class="required">*</span> are required.</p>

<?php
	if(count($modelSalesJournalItem) > 0)
		echo $form->errorSummary(array_merge(array($model), $modelSalesJournalItem)); 
	else 
		echo $form->errorSummary($model); 
?>

<?php if($this->inputMode == 'edit') { ?>
	<div class="form-group ">
		<label class="col-sm-3 control-label required" for="Gl_glType">Voucher #</label>
		<div class="col-sm-9 form-control-value"><strong><?php echo $model->voucherPrefix, ' - ', $model->voucherPostfix; ?></strong></div>
	</div>	
	<div class="form-group ">
		<label class="col-sm-3 control-label required" for="Gl_glType">Create Date</label>
		<div class="col-sm-9 form-control-value"><strong><?php echo $model->createDate; ?></strong></div>
	</div>
	<?php echo $form->dropDownListRow($model,'accountReceivableGlId',CHtml::listData(Gl::getDropdownList('parentUid IN(22)'), 'id', 'title'), array('labelOptions'=>array('class'=>'col-sm-3'),'class'=>'form-control')); ?>
	<?php echo $form->textFieldRow($model,'narration',array('labelOptions'=>array('class'=>'col-sm-3'),'class'=>'form-control','maxlength'=>255)); ?>

<?php } else { ?>

	<?php // echo CHtml::activeHiddenField($model,"voucherPrefix"); ?>	
	<?php // echo CHtml::activeHiddenField($model,"voucherPostfix"); ?>	
	<?php // echo CHtml::activeHiddenField($model,"salesGlId"); ?>	
	<div class="form-group ">
		<label class="col-sm-3 control-label required" for="Gl_glType">Voucher #</label>
		<div class="col-sm-9 form-control-value"><strong>AUTO</strong></div>
	</div>	
	<?php echo $form->textFieldRow($model,'createDate',array('labelOptions'=>array('class'=>'col-sm-3'),'class'=>'form-control', 'inputGroupOptions'=>array('class'=>'date'), 'append'=>'<i class="glyphicon glyphicon-calendar"></i>')); ?>
	<?php echo $form->dropDownListRow($model,'accountReceivableGlId',CHtml::listData(Gl::getDropdownList('parentUid IN(22)'), 'id', 'title'), array('labelOptions'=>array('label'=>'Customer Account','class'=>'col-sm-3'),'class'=>'form-control')); ?>
	<?php echo $form->textFieldRow($model,'narration',array('labelOptions'=>array('class'=>'col-sm-3'),'class'=>'form-control','maxlength'=>255)); ?>

<?php } ?>

<?php echo $this->renderPartial('application.views.salesJournalItem._tabularform', array('form'=>$form, 'modelSalesJournalItem'=>$modelSalesJournalItem)); ?>


<div class="form-actions">
	<?php $this->widget('bootstrap.widgets.TbButton', array(
		'buttonType'=>'submit',
		'type'=>'primary',
		'label'=>$model->isNewRecord ? 'Create' : 'Save',
	)); ?>
</div>

<?php $this->endWidget(); ?>
